import unittest

from parameterized import parameterized

from api.login_api import LoginApi
from utils import read_info


class LoginHR(unittest.TestCase):

    @parameterized.expand(read_info())
    def test_login(self, case_name, user_data, expect_result):
        # print(case_name, user_data, expect_result)
        print(f'进行【{case_name}】接口测试，吼吼吼吼')

        response = LoginApi.login(json=user_data)
        result = response.json()
        print(result)
        self.assertEqual(expect_result.get('resp_code'), response.status_code)
        self.assertEqual(expect_result.get('success'), result.get('success'))
        self.assertEqual(expect_result.get('code'), result.get('code'))
        self.assertEqual(expect_result.get('msg'), result.get('message'))
